Skip to content

Indicate nodes not supported by current event + node folders#1156

Open
Lwmte wants to merge 12 commits intodevelopfrom
unsupported_nodes
Open

Indicate nodes not supported by current event + node folders#1156
Lwmte wants to merge 12 commits intodevelopfrom
unsupported_nodes

Conversation

@Lwmte
Copy link
Copy Markdown
Collaborator

@Lwmte Lwmte commented Mar 15, 2026

Adds an indication that a node is not supported by the current event type:

Clipboard-2

To define whether node is supported or not supported by a particular event type, define new metadata entries:

-- !Unsupported "OnLoop" "OnLevelStart"
-- !Supported "OnVolumeEnter"

Additionally, adds support for folders in the node list.

@Lwmte Lwmte added this to the Version 2.0 milestone Mar 15, 2026
@Lwmte Lwmte added enhancement A task which adds something new or improves on existing features. Tomb Editor Nodes Task specific to TEN Nodes. labels Mar 15, 2026
@Lwmte Lwmte requested review from Nickelony and TrainWrack March 17, 2026 08:01
Nickelony
Nickelony previously approved these changes Mar 22, 2026
Copy link
Copy Markdown
Collaborator

@Nickelony Nickelony left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I'll poke Copilot as well to review just in case.

@Nickelony Nickelony requested a review from Copilot March 22, 2026 21:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds metadata-driven support/unsupported event type tagging for visual scripting nodes, and surfaces a UI warning when a node is used under an incompatible event type.

Changes:

  • Parse new !Supported / !Unsupported metadata tags into NodeFunction definitions.
  • Add support checks (IsUnsupported) to NodeFunction and propagate current event type into the node editor UI.
  • Document the new metadata tags in the TEN node catalog Readme.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
TombLib/TombLib/Utils/ScriptingUtils.cs Parses !Supported / !Unsupported tags into event type lists.
TombLib/TombLib/LevelData/VisualScripting/TriggerNodeEnumerations.cs Stores per-node supported/unsupported event lists and exposes IsUnsupported.
TombLib/TombLib/Catalogs/TEN Node Catalogs/Readme.md Documents the new metadata tag syntax and available event types.
TombLib/TombLib.Forms/Controls/VisualScripting/NodeEditor.cs Displays a warning indicator/message when a node is incompatible with the current event type.
TombEditor/Forms/FormEventSetEditor.cs Propagates event type changes into TriggerManager.
TombEditor/Controls/TriggerManager.cs Exposes EventType and forwards it to the embedded node editor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread TombLib/TombLib.Forms/Controls/VisualScripting/NodeEditor.cs Outdated
Comment thread TombLib/TombLib/Utils/ScriptingUtils.cs Outdated
Comment thread TombLib/TombLib/Catalogs/TEN Node Catalogs/Readme.md Outdated
Comment thread TombLib/TombLib/Utils/ScriptingUtils.cs Outdated
@Lwmte Lwmte changed the title Indicate nodes not supported by current event Indicate nodes not supported by current event + node folders Apr 11, 2026
Copy link
Copy Markdown
Collaborator

@TrainWrack TrainWrack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested multi level folders. They saved and reloaded ok.

Tested nodes event support. Worked as described.

Image

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • TombEditor/Forms/FormEventSetEditor.Designer.cs: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -159,6 +154,8 @@ protected override void Dispose(bool disposing)

if (DialogResult == DialogResult.Cancel)
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dispose currently restores state only when DialogResult == Cancel, but closing the window via the titlebar X typically leaves DialogResult as None, which will fall into the else branch and commit folder/order changes. If the intended behavior is to apply changes only on OK, change this to restore state for any non-OK close (DialogResult != DialogResult.OK) and only sync/apply on OK.

Suggested change
if (DialogResult == DialogResult.Cancel)
if (DialogResult != DialogResult.OK)

Copilot uses AI. Check for mistakes.
public bool GenericMode => GlobalMode || _instance == null;

private HashSet<string> _backupCollapsedFolders;
private HashSet<string> _сollapsedFolders => GlobalMode ? _editor.Level.Settings.CollapsedGlobalEventSetFolders : _editor.Level.Settings.CollapsedVolumeEventSetFolders;
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The identifier _сollapsedFolders appears to use a non-ASCII Cyrillic 'с' character, which is very hard to spot and makes searching/refactoring error-prone. Rename it to an ASCII _collapsedFolders (and update references) to avoid future maintenance issues.

Suggested change
private HashSet<string> _сollapsedFolders => GlobalMode ? _editor.Level.Settings.CollapsedGlobalEventSetFolders : _editor.Level.Settings.CollapsedVolumeEventSetFolders;
private HashSet<string> _collapsedFolders => GlobalMode ? _editor.Level.Settings.CollapsedGlobalEventSetFolders : _editor.Level.Settings.CollapsedVolumeEventSetFolders;

Copilot uses AI. Check for mistakes.
Comment on lines +1149 to +1165
var firstNonDrag = allVisible.FirstOrDefault(n => !_dragNodes.Contains(n));
if (firstNonDrag != null)
{
var firstRect = GetNodeFullRowArea(firstNonDrag);
if (OffsetMousePosition.Y <= firstRect.Top)
{
// Mouse is above the first node — insert before it.
hitNode = firstNonDrag;
position = DropPosition.Before;
indicatorY = firstRect.Top;
}
else
{
// Mouse is below all nodes — append to root.
position = DropPosition.After;
indicatorY = ContentSize.Height;
}
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HandleDrag() uses GetAllNodes() (which returns all nodes, including those under collapsed parents) and then the fallback firstNonDrag logic can pick a non-visible descendant. In that case GetNodeFullRowArea() returns an invalid rect (-1s), and the “mouse above first node” / “append” fallback can behave incorrectly. Fix by iterating only visible nodes for hit-testing/fallback (e.g., build a list by traversing only expanded branches, or filter nodes by checking all ancestors are expanded).

Copilot uses AI. Check for mistakes.
Comment on lines +207 to +208
public HashSet<string> CollapsedGlobalEventSetFolders { get; set; } = new HashSet<string>();
public HashSet<string> CollapsedVolumeEventSetFolders { get; set; } = new HashSet<string>();
Copy link

Copilot AI Apr 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LevelSettings.Clone() uses MemberwiseClone(), so these new HashSet<string> instances will be shared between the original settings and any clones (e.g., forms that work on a cloned LevelSettings). That can cause edits to collapsed folder state in a cloned settings instance to mutate the original. Fix by deep-copying both sets in Clone() (e.g., new HashSet<string>(CollapsedGlobalEventSetFolders) and same for volume).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement A task which adds something new or improves on existing features. Tomb Editor Nodes Task specific to TEN Nodes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants